<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
    <%@page import="util.ParamUtil"%>
<%@page import="model.News"%>
<%@page import="control.NewsControl"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<%
         request.setCharacterEncoding("utf-8");
         int id = ParamUtil.getInt(request,"id");
         News n = new News();
         n.setTitle(ParamUtil.getString(request,"title","未填写"));
         //String content =  ParamUtil.getString(request,"content","未填写");
         n.setContent(request.getParameter("content"));
         n.setKeyword(ParamUtil.getString(request,"keyword","未填写"));
         n.setSubcolumn(ParamUtil.getInt(request,"subcolumn"));
         int sid = n.getSubcolumn();
         //System.out.println(n.getTitle()+"///////"+n.getContent()+"///////"+n.getSubcolumn()+"//////"+n.getKeyword());
         if(NewsControl.updateNews(n,id)){
        	 %>
        	 <script>
        	 alert("修改成功");
             window.location.href="newslist.jsp?sid=<%=sid%>";
        	 </script>
        	 <%
         }else{
        	 %>
        	 <script>
        	 alert("修改失败");
        	 history.go(-1);
        	 </script>
        	 <%
         }

%>
</body>
</html>